<template>
  <div class="sona">
    <button @click="btn">传值给sonb</button>
    <input type="text " v-son />
    <div v-txt="'你好'" ref="form"></div>
  </div>
</template>

<script>
export default {
  directives: {
    son: {
      inserted (dom, obj, vnode) {
        dom.focus()
      }
    },
    txt: {
      inserted (dom, obj, vnode) {
        dom.innerText = obj.value
        console.log(dom, obj, vnode.context.$refs)
      }
    }
  },
  methods: {
    btn () {
      this.$bus.$emit('atob', Date.now())
    }
  }
}
</script>

<style lang="scss" scoped>
.sona {
  width: 200px;
  height: 200px;
  border: 1px solid green;
}
</style>
